package com.degon.hsyl.imagepreview;

import android.content.Context;
import android.content.Intent;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.degon.hsyl.imagepreview.activity.ImageGalleryActivity;

import io.dcloud.feature.uniapp.annotation.UniJSMethod;
import io.dcloud.feature.uniapp.common.UniModule;

public class ImagePreviewModule extends UniModule {


    @UniJSMethod(uiThread = true)
    public void previewImage(JSONObject options) {

        //获取参数
        String current = options.getString("current");
        JSONArray urls = options.getJSONArray("urls");
        //跳转
        Context context = mUniSDKInstance.getContext();
        Intent intent = new Intent(context, ImageGalleryActivity.class);
        intent.putExtra("current", current);
        intent.putExtra("urls", urls);
        context.startActivity(intent);
    }

}
